#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <unistd.h>

#include "led_drv.h"

int main()
{
    int fd = open("/dev/led_drv", O_RDWR);
    if (fd < 0)
    {
        printf("open led_drv failed\n");
        return -1;
    }
    int value;
    ioctl(fd, LED1_SET, LED_OFF);
    ioctl(fd, LED2_SET, LED_OFF);
    sleep(1);
    ioctl(fd, LED1_SET, LED_ON);
    ioctl(fd, LED1_GET, &value);
    printf("led1 value = %d\n", value);
    sleep(1);
    ioctl(fd, LED2_SET, LED_ON);
    ioctl(fd, LED2_GET, &value);
    printf("led2 value = %d\n", value);
    sleep(1);
    //
    close(fd);

    return 0;
}